import com.bite.TestDemo;//自己创建的类名为TestDemo的包

import java.util.Date;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 苏李涛
 * Date: 2024-05-11
 * Time: 10:38
 */

class Student {
    //用private把他们封装起来
    private String name;
    private int age;
    private int id;
    public static String className;
    public void doClass (){

    }

    public Student(String name, int age, int id) {
        this.name = name;
        this.age = age;
        this.id = id;
    }

    //封装后提供，get，set公开接口来给予部分功能访问
    public String getName() {
        return this.name;
    }
    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public void show() {
        System.out.println("姓名" +this.name +  "学号" + this.id +  "年龄"
                + this.age  + " " + "班级" + className);
    }

}

public class Test {
    public static void main1(String[] args) {
        Student student1 = new Student("xiaohua", 12, 23005678);
        student1.setName("lisi");
        System.out.println(student1.getName());

        student1.setAge(11);
        System.out.println(student1.getAge());

        student1.setId(230788);
        System.out.println(student1.getId());
    }

    public static void main(String[] args) {
        Student student1 = new Student("xiaohua", 12, 23005678);
        student1.className = "1";

//        Student.className = "1班";//学生都属于一班
        student1.show();

        System.out.println(Student.className);

        Student student2 = new Student("xiaohua", 12, 23005678);
        student1.className = "2";
        student2.show();


        Student student3 = new Student("xiaohua", 12, 23005678);
      student3.className = "1";
        student3.show();
    }

}
